//
//  ReadingTaskDetailModel.swift
//  Employee
//
//  Created by tancheng on 2018/6/25.
//  Copyright © 2018年 remotevillage. All rights reserved.
//

import Foundation
import SwiftyJSON

struct ReadingMeterTaskDetailModel: ModelProtocol {
    
     var actualUsage = 0 //实际用量
     var collaborativeTask = ""
     var houseNumber = ""
     var lastRead = ""
     var meterAscription = ""
     var meterId = ""
     var meterNumber = ""
     var meterReadDate = ""
     var readingDate = ""
     var readingStaffName = ""
     var status: ReadingMeterTaskStatusType = .waitCommit
     var taskId = ""
     var thisRead = ""
     var files:[NewImageModel] = []
     var title = ""
     var cooperation = false
     var isCommit = false
    
    
    init(json: JSON) {
         actualUsage = json["actualUsage"].intValue //实际用量
         collaborativeTask = json["collaborativeTask"].stringValue
         houseNumber = json["houseNumber"].stringValue
         lastRead = json["lastRead"].stringValue
         meterAscription = json["meterAscription"].stringValue
         meterId = json["meterId"].stringValue
         meterNumber = json["meterNumber"].stringValue
         meterReadDate = json["meterReadDate"].stringValue
         readingDate = json["readingDate"].stringValue
         readingStaffName = json["readingStaffName"].stringValue
        
         status = ReadingMeterTaskStatusType(rawValue: json["status"].stringValue) ?? .waitCommit
        
         taskId = json["taskId"].stringValue
         thisRead = json["thisRead"].stringValue
        
         files = NewImageModel.array(from: json["files"].arrayValue)
        
        title = json["title"].stringValue
        cooperation = json["cooperation"].boolValue
        isCommit = json["isCommit"].boolValue
        
    }
    
    static func array(from jsonArray: [JSON]) -> [ReadingMeterTaskDetailModel] {
        return jsonArray.map({ReadingMeterTaskDetailModel.init(json: $0)})
    }
    
}

struct ReadingMeterDetailSend {//获取抄表详情send
    var taskId = ""
    var meterId: String?
    
}

struct ReadingMeterDetailSubmitSend {//提交抄表详情send
     var taskId = ""
     var fileIds = ""
     var meterRead = ""
}
